package com.lin.community_thumb_sys.common;

/**
 * 用户模块常量定义
 */
public final class UserConstant {

    // 私有构造方法，防止实例化
    private UserConstant() {
        throw new UnsupportedOperationException("Constant class cannot be instantiated");
    }

    // ==================== 缓存相关 Key ====================
    /**
     * 用户登录Token缓存前缀 (格式: token:userId)
     */
    public static final String CACHE_TOKEN_KEY = "user:token:%s";

    /**
     * 用户信息缓存前缀 (格式: user:info:userId)
     */
    public static final String CACHE_USER_INFO_KEY = "user:info:%s";

    // ==================== Session/Request 属性键 ====================
    /**
     * 当前登录用户的Session属性键
     */
    public static final String LOGIN_USER_SESSION_KEY = "LOGIN_USER";

    /**
     * 当前用户ID的Request属性键（用于拦截器传递）
     */
    public static final String REQUEST_USER_ID_KEY = "X-User-Id";

    // ==================== 用户状态 ====================
    /**
     * 正常状态
     */
    public static final int USER_STATUS_NORMAL = 1;

    /**
     * 禁用状态
     */
    public static final int USER_STATUS_DISABLED = 0;

    // ==================== 角色/权限标识 ====================
    /**
     * 管理员角色标识
     */
    public static final String ROLE_ADMIN = "admin";

    /**
     * 普通用户角色标识
     */
    public static final String ROLE_USER = "user";

    // ==================== 权限字符串 ====================
    /**
     * 用户新增权限
     */
    public static final String PERMISSION_USER_ADD = "user:add";

    /**
     * 用户删除权限
     */
    public static final String PERMISSION_USER_DELETE = "user:delete";

    // ==================== 默认值 ====================
    /**
     * 默认用户头像URL
     */
    public static final String DEFAULT_AVATAR = "https://example.com/default-avatar.png";

    /**
     * 默认分页大小
     */
    public static final int DEFAULT_PAGE_SIZE = 10;

    // ==================== 错误码（可结合BizException使用） ====================
    /**
     * 用户不存在错误码
     */
    public static final int ERROR_USER_NOT_EXIST = 10001;

    /**
     * 用户被禁用错误码
     */
    public static final int ERROR_USER_DISABLED = 10002;
}
